using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class IniMate_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(global::IniMate);

            field = type.GetField("index", flag);
            app.RegisterCLRFieldGetter(field, get_index_0);
            app.RegisterCLRFieldSetter(field, set_index_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_index_0, AssignFromStack_index_0);
            field = type.GetField("values", flag);
            app.RegisterCLRFieldGetter(field, get_values_1);
            app.RegisterCLRFieldSetter(field, set_values_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_values_1, AssignFromStack_values_1);


            app.RegisterCLRCreateDefaultInstance(type, () => new global::IniMate());
            app.RegisterCLRCreateArrayInstance(type, s => new global::IniMate[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }



        static object get_index_0(ref object o)
        {
            return ((global::IniMate)o).index;
        }

        static StackObject* CopyToStack_index_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((global::IniMate)o).index;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_index_0(ref object o, object v)
        {
            ((global::IniMate)o).index = (System.String)v;
        }

        static StackObject* AssignFromStack_index_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.String @index = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((global::IniMate)o).index = @index;
            return ptr_of_this_method;
        }

        static object get_values_1(ref object o)
        {
            return ((global::IniMate)o).values;
        }

        static StackObject* CopyToStack_values_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((global::IniMate)o).values;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_values_1(ref object o, object v)
        {
            ((global::IniMate)o).values = (System.Collections.Generic.List<global::KeyValue>)v;
        }

        static StackObject* AssignFromStack_values_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Collections.Generic.List<global::KeyValue> @values = (System.Collections.Generic.List<global::KeyValue>)typeof(System.Collections.Generic.List<global::KeyValue>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((global::IniMate)o).values = @values;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new global::IniMate();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
